<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateStatSysGiftTable extends Migration
{
    protected $connection = 'stat';

    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('stat_daily_sys_gift', function (Blueprint $table) {
            $table->increments('id');
            $table->date('dt')->comment('统计日期');
            $table->integer('send_num')->default(0)->comment('推送系统礼物总数');
            $table->integer('receive_num')->default(0)->comment('领取系统礼物总数');
            $table->integer('send_from_num')->default(0)->comment('推送礼物男用户数');
            $table->integer('send_to_num')->default(0)->comment('收到礼物女用户数');
            $table->integer('receive_user_num')->default(0)->comment('领取系统礼物用户数');
            $table->double('receive_gift_coin', 10, 1)->default(0.0)->comment('被领取礼物总价值');
            $table->double('actual_income_coin', 10, 1)->default(0.0)->comment('实际礼物到账总额');
            $table->timestamps();
            $table->tinyInteger('flag')->default(1)->comment('记录状态');
            $table->index('dt', 'dt');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('stat_daily_sys_gift');
    }
}
